package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.SoulQuestionApi;
import com.tanhua.dubbo.mapper.SoulQuestionMapper;
import com.tanhua.dubbo.pojo.SoulQuestion;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService(version = "1.0.0")
public class SoulQuestionApiImpl implements SoulQuestionApi {

    @Autowired
    private SoulQuestionMapper soulQuestionMapper;

    @Override
    public List<SoulQuestion> queryListById(Long id) {
        QueryWrapper<SoulQuestion> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("questionnaire_id", id);
        return this.soulQuestionMapper.selectList(queryWrapper);
    }

    @Override
    public SoulQuestion queryOneById(Long id) {
        QueryWrapper<SoulQuestion> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        return this.soulQuestionMapper.selectOne(queryWrapper);
    }
}
